<template>
  <div class="selectItem">
    <!-- 单选 -->
    <div v-if="form.type == 1">
      <div class="item" v-for="(item,index) in form.select_options" :key="index">
        <el-radio v-model="form.single_select_answer" :label="item.label" @change="selectChange('single_select_answer')">{{ item.label }}</el-radio>
        <el-input v-model="item.text"></el-input>
        <!-- 文件上传 -->
        <upload v-model="item.image" type="img"></upload>
      </div>
    </div>
    <!-- 多选 -->
    <div v-else-if="form.type == 2">
      <div class="item" v-for="(item,index) in form.select_options" :key="index">
        <el-checkbox v-model="form.multiple_select_answer" :label="item.label">{{item.label}}</el-checkbox>
        <el-input v-model="item.text"></el-input>
        <!-- 文件上传 -->
         <upload v-model="item.image" type="img"></upload>
      </div>
    </div>
    <!-- 简答 -->
    <div v-else>
      <div class="item">
        <el-input type="textarea" :rows="3" v-model="form.short_answer"></el-input>
      </div>
    </div>
  </div>
</template>

<script>
import upload from "@/components/upload.vue";
export default {
  components: { upload },
  props: ["form"],
  data(){
      return {
          value:'',
      }
  },
  methods: {
    selectChange(msg){
      this.$emit('sonItem',msg)
    }
  }
};
</script>

<style lang="less">
.selectItem {
    .item {
        display: flex;
        align-items: center;
        margin-top: 40px;
    }
    .el-input {
        width: 476px!important;
    }
    .el-checkbox {
        margin-right: 20px;
    }
}
</style>